<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="path/to/your-icon.ico" type="image/x-icon">
</head>
<body>
    <script type="module">
        import xxx,{a as aaa,compute as com} from "./add.js"
        import {b,compute} from ".sub.js"
        console.log(aaa)
        let result =com()
        console.log(result)
        console.log("add.js的默认导出："+xxx)
        //js模块化后 其内部的变量和方法外界无法访问

        //动态导入
        let btn =document.getElementById("btn")
        btn.addEventListener("click",()=>{
            let sub=import("./sub.js")
            console.log(sub)
            sub.then((module)=>{
                console.log(module)
                console.log(module.compute())
            })
        })
    </script>
    
</body>
</html>